<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>FiveClothes后台管理系统登录</title>
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="shortcut icon" href="./favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="static/css/font.css">
<link rel="stylesheet" href="static/css/weadmin.css">
<link rel="stylesheet" href="js/layui/css/layui.css" media="all" />
<script src="js/layui/layui.js"></script>

</head>
<body class="login-bg">

	<div class="login">
		<div class="message">FiveClothes后台管理系统登录</div>
		<div id="darkbannerwrap"></div>

		<form method="post" class="layui-form" id="login">
			<input name="u_name" placeholder="用户名" type="text" id="name" lay-verify="required" class="layui-input">
			<hr class="hr15">
			<input name="u_password" lay-verify="required|pass" id="pwd" placeholder="密码" type="password" class="layui-input">
			<hr class="hr15">
			<input class="loginin layui-btn" value="登录" lay-submit lay-filter="login" style="width: 100%;">
			<hr class="hr20">

		</form>
	</div>

	<script type="text/javascript">
		layui.use([ 'form', 'layer' ], function() {
			form = layui.form, layer = layui.layer, $ = layui.$;
			$("#pwd").blur(function(e) {
				if (/^[\S]{1,6}$/.test($("#pwd").val())) {
					layer.msg("密码格式正确", {
						icon : 6
					});
				} else {
					layer.msg("密码必须1到6位", {
						icon : 3
					});
				}
			})
			$("#name").blur(
					function(e) {
						if ($("#name").val().length <= 6
								&& $("#name").val().length >= 2) {
							layer.msg("用户名格式正确", {
								icon : 6
							});
						} else {
							layer.msg("用户名为2~6位", {
								icon : 5
							});
						}
					})
			form.on('submit(login)', function(data) {

				$.post('http://localhost:8080/FiveClothes/user', $("#login")
						.serialize(), function(res) {
					if (res.code == 0&&res.msg=="否") {
						location.href = 'index.html';
					}else if(res.code == 0&&res.msg=="是"){
						layer.alert("该账号已锁定，不可使用！",{icon:2});
					} else {
						layer.alert("信息错误，登录失败",{icon:2});
					}
				}, "json");
			})
		})
	</script>

</body>
</html>